import QuickTool from '@/utils/Engineering/QuickTool';
import { maintableOperateExpandList } from '../main.data';

const apiPath = {
  submitDataBaseURL: '/api/common/sys_table_set_action',
  getDatasourceURL: `/api/common/sys_table_set_action/page`,
  basis: 'id',
};
const extraData = {
  __sent_data_diff_cover_field: '',
};

const pagination = { pageSize: 10, current: 1 };

const tableOperateExpandList = [maintableOperateExpandList.TableFieldSettting];

const popupForm = {
  open_type: 'Drawer',
  width: '65%',
};

const fieldList = [
  // {
  //   form_type: 'Input',
  //   title_or_label: QuickTool.tooltip({ title: 'id', help: 'id', required: true }),
  //   dataIndex_or_field: 'id',
  //   key: 'id',
  //   placeholder: '',
  //   fixed: 'left',
  //   width: 160,
  //   col: 12,
  //   initialValue: '',
  //   list: [],
  // },

  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: 'UUID码', help: 'UUID码', required: true }),
    dataIndex_or_field: 'sys_table_set_code',
    key: 'sys_table_set_code',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: 'code', help: 'code', required: true }),
    dataIndex_or_field: 'code',
    key: 'code',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Select',
    title_or_label: QuickTool.tooltip({
      title: '动作函数',
      help: '动作函数名',
      required: true,
    }),
    dataIndex_or_field: 'right_type_field',
    key: 'right_type_field',
    placeholder: '',
    width: 180,
    col: 12,
    initialValue: '',
    list: [
      { value: 'handleSingleQuickEdit', alias: 'handleSingleQuickEdit', name: '编辑' },
      { value: 'handleSingleDelete', alias: 'handleSingleDelete', name: '删除' },
      { value: 'handleSingleCopy', alias: 'handleSingleCopy', name: '复制' },
      { value: 'handleModalEdit', alias: 'handleModalEdit', name: '弹窗编辑' },
      { value: 'handleSingOutsideNewAdd', alias: 'handleSingOutsideNewAdd', name: '新增' },
      { value: 'handleQuickEdit', alias: 'handleQuickEdit', name: '快捷编辑' },
      { value: 'handleBatchDelete', alias: 'handleBatchDelete', name: '批量删除' },
      { value: 'test', alias: 'test', name: '测试' },
    ],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '动作名称', help: '动作名称', required: true }),
    dataIndex_or_field: 'action_name',
    key: 'action_name',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '排序', help: '排序', required: true }),
    dataIndex_or_field: 'sort',
    key: 'sort',
    placeholder: '',
    width: 80,
    col: 12,
    initialValue: '',
    list: [
      { value: 'default', name: 'default' },
      { value: 'middle', name: 'middle' },
      { value: 'small', name: 'small' },
    ],
  },
  {
    form_type: 'Select',
    title_or_label: QuickTool.tooltip({
      title: '操作位置',
      help: '操作的位置是在哪里',
      required: true,
    }),
    dataIndex_or_field: 'position',
    key: 'position',
    placeholder: '',
    width: 120,
    col: 12,
    initialValue: '',
    list: [
      { value: 'inside', name: '表内' },
      { value: 'outside', name: '表外' },
    ],
  },

  {
    form_type: 'Switch',
    title_or_label: QuickTool.tooltip({ title: '是否分组', help: '是否分组', required: true }),
    dataIndex_or_field: 'is_group',
    key: 'is_group',
    placeholder: '',
    width: 80,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Switch',
    title_or_label: QuickTool.tooltip({ title: '显示条件', help: '显示条件', required: true }),
    dataIndex_or_field: 'show_condtion',
    key: 'show_condtion',
    placeholder: '',
    width: 80,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({
      title: '操作权限控制',
      help: '操作权限控制',
      required: true,
    }),
    dataIndex_or_field: 'right_type',
    key: 'right_type',
    placeholder: '',
    width: 180,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Select',
    title_or_label: QuickTool.tooltip({
      title: '按钮模式',
      help: '按钮模式',
      required: true,
    }),
    dataIndex_or_field: 'action_form',
    key: 'action_form',
    placeholder: '',
    width: 180,
    col: 12,
    initialValue: '',
    list: [
      { value: 'Modal', name: '对话框' },
      { value: 'Drawer', name: '抽屉' },
      { value: 'Popconfirm', name: '气泡确认框' },
      { value: 'Popover', name: '气泡卡片' },
    ],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({
      title: 'action_url',
      help: 'action_url',
      required: true,
    }),
    dataIndex_or_field: '对话框地址',
    key: '对话框地址',
    placeholder: '',
    width: 180,
    col: 24,
    initialValue: '',
    list: [],
  },
];

const initialSearchList: {
  col?: number;
  form_type?: string;
  title_or_label?: JSX.Element | string;
  dataIndex_or_field?: string;
  key?: string;
  placeholder?: string;
  width?: number;
  initialValue?: string;
  list?: {
    value?: string;
    name?: string;
  }[];
  custom_sort?: boolean;
}[] = [
  // { form_type: '__operate', custom_sort: true },
  { ...fieldList[0], col: 6 },
  { ...fieldList[1], col: 6 },
  { ...fieldList[2], col: 6 },
  { ...fieldList[3], col: 6 },
];

const dataSource = [
  {
    sys_form_set_code: 'f97c6421decb',
    label: '内容发布',
    data_url: '/api/common/vw_baade_notice/page',
    placeholder: '请输入标签名称',
    size: 'middle',
    required: 1,
    tooltip: '发布内容的东西',
    rowKey: 'id',
    is_pagination: 0,
    is_add: 1,
    is_delete: 1,
    expanded_code: '',
    delete_url: '',
    editable: false,
    sort: 1,
  },
  {
    sys_form_set_code: 'f97c6421decb',
    label: '内容发布',
    data_url: '/api/common/vw_baade_notice/page',
    placeholder: '请输入标签名称',
    size: 'middle',
    required: 1,
    tooltip: '发布内容的东西',
    rowKey: 'id',
    is_pagination: 0,
    is_add: 1,
    is_delete: 1,
    expanded_code: '',
    delete_url: '',
    editable: false,
    sort: 2,
    field: 'content',
    form_type: 'Input',
  },
];

export {
  fieldList,
  initialSearchList,
  dataSource,
  apiPath,
  tableOperateExpandList,
  pagination,
  extraData,
  popupForm,
};
